<?php
//echo "<pre>";print_r($_SERVER);EXIT;
require_once("PHPMailer/sendmail.php");
ini_set('display_errors', '0');
include("connect.php");
$to=$_POST['email'];
$token=time();
$email_result = mysql_query("select user_id from user where email_id='".$to."'");
$row=mysql_fetch_row($email_result);
if($row!='')
{
//echo "<pre>";print_r($row);EXIT;
$query = mysql_query("update user set token='".$token."' where email_id='".$to."'");
$msg="Dear Admin <br/> Please click below link to reset your password <br/>";
$msg.="<a href='http://".$_SERVER['HTTP_HOST']."".str_replace("/reset.php","",$_SERVER['REQUEST_URI'])."/reset_password.php?token=".$token."&email=".base64_encode($to)."'>Reset Password link</a>";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <info@aapthitech.com>' . "\r\n";
//if(sendMail($to,"Reset Password",$msg))
if(mail($to,"Reset Password",$msg,$headers))
{
	echo "1";
}else
{
	echo "0";
}
}else{
echo "0";
}
?>